home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98a.txt
/
000064_icon-group-sender _Thu Feb 26 13:58:29 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
4KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.7/8.8.7) with SMTP id NAA08833
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Thu, 26 Feb 1998 13:58:28 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA32133; Thu, 26 Feb 1998 13:58:28 -0700
Date: Thu, 26 Feb 1998 16:06:02 GMT
Message-Id: <199802261606.QAA12542@gairsay.aiai.ed.ac.uk>
From: Jeff Dalton <jeff@aiai.ed.ac.uk>
Subject: Re: Translation into C
To: icon-group@optima.CS.Arizona.EDU
In-Reply-To: gep2@computek.net's message of Wed, 25 Feb 1998 13:30:10 -0600
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 3320
Gordon Peterson wrote:
> > Mark Evans suggested that the reason one might want an Icon to C
> translator is that the resulting program will execute faster because it
> doesn't need to be interpreted. But I wonder how much difference that
> would really make. If the C program spends most of its time calling
> library routines, then I wouldn't expect much difference at all.
>
> Right.
>
> > Does anyone have statistics that might answer this question?
>
> I think that statistics for different implementations will vary all over the
> place... I'd comment though that generally the overhead of an interpreter is
> less (and the advantages are more) for higher-level languages than for
> lower-level ones, for exactly the reason you yourself suggested
> above.
The experience with Lisp has been that compilation to "native code"
(even via compilation to C) makes a big difference. (Probably a
factor of 10 to 30 over list-structure interpreters), though I haven't
seen actual statistics for a long time.) I normally run any
substantial Lisp program compiled if I can, and I have seen it make
a factor of 30 difference. (N.B. 30 times faster, _not_ 30 percent.)
Prolog, however, has often been implemented by compilation to byte
codes (or similar) with a heavily optimized and cleverly written
interpreter for the byte codes. My impression was that this worked
fairly well, though again I don't have actual numbes to hand.
A more or less straight interpreter for Porlog (cprolog) was
suprisingly fast for an interpreter, but still sunstantially
slower than the byte-code-compiled systems.
(Asking in Comp.lang.lisp, Comp.lang.scheme, and Comp.lang.prolog
might be a good idea.)
When Lisp (and I include Scheme in Lisp) is compiled to byte codes,
the result can be ok, but so far I haven't found it a completely
satisfactory alternative to full compilation.
An example of a commonly-used Lisp compiled to byte codes is the one
in GNU emacs. It seems to work fairly well (obviously, opinions
differ about almost everything when it comes to Emacs), but the sorts
of things people do in Emacs probably have the Lisp spending a greater
proportion of time in "library routines" than is typical for Lisp
programs.
My suspicion is that it may well be a win to compile Icon to native
code via C, but how much of a win will depend on how much the compiler
manages to compile in-line and on what the alternative implementations
are. A simple compile-via-C compiler that didn't compile much in-line
might not produce much faster results than a very good compiler to
byte codes plus a very good interpreter for the byte codes.
The design of the byte-code instruction set also matters. There
was a revolution in Prolog implementation that came with the so-called
Warren Abstract Machine (WAM), and earlier, more stack-machine-like,
instruction sets could not compete.
(By "byte codes", etc, I really mean instructions for some virtual
machine. These are often byte-codes, but they can be longer or vary
in other ways.)
(For some reason the Java VM is a stack machine, despite the
involvement of people who knew what had happened in the Prolog
world. But perhaps they are not expecting to get Java speed
via VM efficiency, relying instead, perhaps, on various sorts
of more complete compilation.)
-- jeff